package com.neusoft.neu24.nep.bootaop.demos.service.impl;

import com.neusoft.neu24.nep.bootaop.demos.service.IMemberService;
import org.springframework.context.support.ClassPathXmlApplicationContext;
import org.springframework.transaction.annotation.Isolation;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
@Transactional
public class MemberServiceImpl implements IMemberService {




//    @Transactional(  propagation = Propagation.REQUIRED ,isolation = Isolation.REPEATABLE_READ )
    public void add(){
//        mapper1
//        mapper2
//        mapper3

    }

    @Override
    public void addMember(int  i ) {
        System.out.println(i );
        System.out.println("MemberServiceImpl.addMember");
    }

//    非事务执行
    @Transactional(readOnly = true)
    @Override
    public void selectAll() {
        System.out.println("selectAll");
    }

    public static void main(String[] args) {
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext("application.xml");
        IMemberService memberServiceImpl = (IMemberService) context.getBean("memberServiceImpl");
        memberServiceImpl.selectAll();
        memberServiceImpl.addMember(123);

    }


}
